package PAT.乙.模拟;

import java.awt.*;
import java.awt.font.TextMeasurer;
import java.util.Scanner;

/**
 * 数组元素循环右移问题
 *
 * @author yang
 * @date 2021/12/16
 */
public class 数组元素循环右移问题 {

    static int N = 110;
    static int n;
    static int num;
    static int[] arr = new int[N];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        num = sc.nextInt();
        for (int i = 0;i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int[] temp = new int[n];
        int j = 0;
        for (int i = n - num; i < n; i++) {
            temp[j] = arr[i];
            j++;
        }
        for (int i = 0; i < n - num; i++) {
            temp[j] = arr[i];
            j++;
        }
        for (int i = 0; i < temp.length; i++) {
            if (i != temp.length - 1)
                System.out.println(temp[i] + " ");
            else
                System.out.println(temp[i]);
        }
    }

}
